package com.blacksheep.mtm.controller;

import com.blacksheep.mtm.common.utils.ResultUtil;
import com.blacksheep.mtm.dao.TbIceConfigMapper;
import com.blacksheep.mtm.pojo.common.DataTablesResult;
import com.blacksheep.mtm.pojo.common.Result;
import com.blacksheep.mtm.pojo.manager.TbIceConfig;
import com.blacksheep.mtm.service.IceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;

import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;

@RestController
@Api("冰块配置")
public class IceConfigController {

    @Autowired
    private TbIceConfigMapper configMapper;

    @RequestMapping(value = "/ice/config",method = RequestMethod.GET)
    @ApiOperation(value = "冰块配置")
    public Result<TbIceConfig> getConfig(){
        TbIceConfig result = configMapper.selectByPrimaryKey(1);
        return new ResultUtil<TbIceConfig>().setData(result);
    }
    @RequestMapping(value = "/ice/config/update",method = RequestMethod.POST)
    @ApiOperation(value = "更改配置")
    public Result<Integer> insertOut(TbIceConfig config){
        int result = configMapper.updateByPrimaryKey(config);
        return new ResultUtil<Integer>().setData(result);
    }
}
